import Taro from "@tarojs/taro";
let cache: any = null;
export const getNaviigationRect = () => {
  function getRect() {
    let rect = Taro.getMenuButtonBoundingClientRect();

    let systemInfo = Taro.getSystemInfoSync();
    let barHeight = rect.top - systemInfo.statusBarHeight + rect.bottom;
    return {
      rect,
      systemInfo,
      statusBarHeight: systemInfo.statusBarHeight,
      contentBarHeight: barHeight - systemInfo.statusBarHeight,
      barHeight,
    };
  }
  return (cache || (cache = getRect())) as ReturnType<typeof getRect>;
};
